<template>
    <div>
        <list-table ref="listTable" @showDialog="showDialog" v-bind="$attrs"  v-on="$listeners"></list-table>
        <create-document-dialog ref="myDialog" :visible.sync="visible" v-if="visible" :row="currRow" @reloadList="query"></create-document-dialog>
        <detail-document-dialog :visible.sync="detailVisible" v-if="detailVisible" :row="currRow" @reloadList="query"></detail-document-dialog>
    </div>
</template>
<script>
    import ListTable from "../components/ListTable";
    import LeftForm from "./LeftForm";
    import IssueViewDialog from "../../../components/WorkFlowsDialog/DocumentCase/IssueViewDialog";
    import openDialog from '@/mixins/openDialog'
    import MyWord from "@/components/WorkFlowsDialog/DocumentCase/MyWord";
    import AttachmentsList from "../../../components/WorkFlowsDialog/DocumentCase/AttachmentsList";
    import PreviewFile from "@/components/Common/PreviewFile";
    import NotesButton from "../../../components/WorkFlowsDialog/Case/Buttons/AddNotesButton";
    import NotesListButton from "../../../components/WorkFlowsDialog/DocumentCase/NotesListButton";
    import schoolSignature from "@/api/officialDocument/schoolSignature/index";
    import isSelectApprover from "@/mixins/isSelectApprover";
    import ApproverList from "../../../components/WorkFlowsDialog/Case/ApproverList";
    import CreateDocumentDialog from "../../../components/WorkFlowsDialog/CreateDocumentDialog";
    import DetailDocumentDialog from "../../../components/WorkFlowsDialog/DetailDocumentDialog";
    export default {
        name: "TabContent",
        mixins: [openDialog,isSelectApprover],
        components: {
          DetailDocumentDialog,
          CreateDocumentDialog,
            ApproverList,
            NotesListButton,
            NotesButton,
            PreviewFile,
            AttachmentsList, MyWord, IssueViewDialog, LeftForm, ListTable},
        data() {
            return {
                visible: false,
                detailVisible:false,
                currRow:{},
            }
        },
        created() {
        },
        computed: {
        },
        methods: {
            query() {
              this.$refs["listTable"].getList();
            },
            showDialog(row,type){
                if(row.id){
                    schoolSignature.getDocumentById(row.id).then(res=>{
                        this.currRow  = res.data
                        if(type=="handle"){
                            this.showActiveBtn = true
                            this.detailVisible = true
                        }else if(type=='view'){
                            this.showActiveBtn = false
                            this.detailVisible = true
                        } else if(type=="edit"){
                            this.visible = true
                        }
                    })
                }else{
                    this.currRow  ={}
                    this.visible = true
                }
            },
        }
    }
</script>
